<?php

use yii\helpers\Html;
use yii\grid\GridView;
use mdm\admin\components\Helper;
use common\models\kaoguobao\Bonus;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '红包详情';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="account-wechat-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            'id',
            'order_num',
            'user_id',
            [
                'attribute' => 'amount',
                'value' => function($model) {
                    return number_format($model->amount/100,2);
                },
            ],
            'key',
            [
                'attribute' => 'type',
                'value' => function($model) {
                    if (isset($model->type)) {
                        return Bonus::$typeName[$model->type];
                    }else{
                        return '';
                    }
                },
            ],
            [
                'attribute' => 'bonus_type',
                'value' => function($model) {
                    if (isset($model->bonus_type)) {
                        return Bonus::$bonusType[$model->bonus_type];
                    }else{
                        return '';
                    }
                },
            ],
            [
                'attribute' => 'bonus_state',
                'value' => function($model) {
                    if (isset($model->bonus_state)) {
                        return Bonus::$bonusState[$model->bonus_state];
                    }else{
                        return '';
                    }
                },
            ],
            'remarks',
            'created_at:date',
            [
                'class' => 'yii\grid\ActionColumn',
                'template' => Helper::filterActionColumn(['view', 'bonus_state' ]),

            ],
        ],
    ]); ?>

</div>
